package com.test.logindemo2.action;

import com.test.logindemo2.dao.Dao;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.apache.struts2.interceptor.RequestAware;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author lzy
 * @version v1.0
 * Create DateTime: 2018/9/9 18:52
 */
@Getter
@Setter
@ToString(exclude = {"dao", "requestMap"})
public class Employee implements RequestAware {
    private Dao dao = new Dao();

    private String name;
    private String password;
    private Integer gender;
    private Integer dept;
    private List<Integer> roles;
    private String desc;
    private Map<String, Object> requestMap = new HashMap<>();

    public String input() {
        requestMap.put("depts", dao.getDepartments());
        requestMap.put("roles", dao.getRoles());
        return "input";
    }

    public String save() {
        System.out.println("save:" + this);
        return "save";
    }

    @Override
    public void setRequest(Map<String, Object> request) {
        this.requestMap = request;
    }
}
